<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- 引入主题样式 -->
<link href="themes/gray/easyui.css" rel="stylesheet">
<!-- 引入图标的样式 -->
<link href="themes/icon.css" rel="stylesheet">
<!-- 先引入jquery -->
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
<!-- 引入easyui -->
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="js/easyui-lang-zh_CN.js"></script>
</head>
<script type="text/javascript">
$(function(){
	$('#dgspe').datagrid({
		queryParams:{tid:${tid}},
	    url:'dgspecific.do', 
	    striped:true,
	    rownumbers:true,
	    singleSelect:true,
	    pagination:true,
	    pageNumber:1,
	    pageSize:28,
	    pageList:[28,38,48],
	    columns:[[    
	        {field:'cid',title:'cid',hidden:true,width:100},    
	        {field:'ctitle',title:'知识标题',width:'50%'},
	        {field:'cname',title:'知识类型',width:'25%',align:'center'},
	        {field:'ctime',title:'发布日期',width:'25%',align:'center'},
	    ]],
	    onLoadSuccess:function(){
	    	$('#win').window('close');
	    },
	    onDblClickCell:function(index,field,value){
	    	//返回所选行的对象
	    	var op = $('#dgspe').datagrid('getSelected');
	    	//通过所选行对象拿到cid
	    	var ccontent = op.ccontent;
	    	var cid = op.cid;
	    	//$('#win').window('open');
	    	//$.getContent(ccontent);
	    	location.href="details.do?cid="+cid;
	    	addNumber(op.cid);
	    }
	});
	
	
	//为页面加入为本内容
 	$.getContent=function(value){
		 $('#content').text(value);		
 	}
	
	
	function addNumber(number){
		
		$.ajax({
			url:'addNumber.do',
			type:'post',
			data:{'number':number},
			dataType:'json',
			success:function(){
				
			}
		})
		
	}
	
	
	$('#win').window({    
 	    width:'90%',    
 	    height:'90%',
 	    title:'知识内容',
 	    modal:true,
 	    closed:true,
 	    shadow:true
 	});
	
 
	$('#btn').linkbutton({    
		onClick:function(){
			go();
		}   
	});
	
	function go(){
		location.href='main.jsp';
	}
	
	$('#comboxt').combobox({    
 		onSelect:function(record){
 			
 			
 		}
 	});
	
	
	function search(combo,svalues){
		$('#dgspe').datagrid({
			queryParams:{combox:combo,value:svalues},
		    url:'search.do', 
		    striped:true,
		    rownumbers:true,
		    singleSelect:true,
		    pagination:true,
		    pageNumber:1,
		    pageSize:28,
		    pageList:[28,38,48],
		    columns:[[    
		        {field:'cid',title:'cid',hidden:true,width:100},    
		        {field:'ctitle',title:'知识标题',width:'50%'},
		        {field:'cname',title:'知识类型',width:'25%',align:'center'},
		        {field:'ctime',title:'发布日期',width:'25%',align:'center'},
		    ]],
		    onLoadSuccess:function(){
		    	$('#win').window('close');
		    },
		    onDblClickCell:function(index,field,value){
		    	//返回所选行的对象
		    	var op = $('#dgspe').datagrid('getSelected');
		    	//通过所选行对象拿到cid
		    	var ccontent = op.ccontent;
		    	var cid = op.cid;
		    	//$('#win').window('open');
		    	//$.getContent(ccontent);
		    	location.href="details.do?cid="+cid;
		    	addNumber(op.cid);
		    }
		}); 
		
	}
	
	//查询按钮
 	$('#btnt').linkbutton({  
 		 onClick:function(){
 			var combo = $('#comboxt').combobox('getValue')
 			var svalues = $('#searcht').val();
 			search(combo,svalues);
 	      }
 	});
	
	
});
</script>
<body>
<div id="cc" class="easyui-layout" style="width:100%;height:100%;">   
    <div data-options="region:'north',split:true" style="height:15%;">
    	<div style="height: 30px; width: 80%; margin-left: 30px; margin-top: 13px; ">
			<p style="display: inline; ">搜索一下:</p>
			<select id="comboxt" style="width: 100px; ">   
  				<option value="全文">全文</option>
  				<option>知识标题</option>
  				<option>知识内容</option>
    			<option>摘要</option>
    			<option>专题知识</option>   
			</select>   
			<input style="width: 500px; " id="searcht" class="easyui-validatebox" type="text" name="tname" />
			<a class="easyui-linkbutton" id="btnt" href="#">检索</a>
		</div>
    	<div style="margin-top: 60px; margin-left: 1000px; ">
    		<a id="btn" href="#" class="easyui-linkbutton">返回首页</a>
    	</div>
    
    </div>   
    <div data-options="region:'center'" style="padding:5px;background:#eee;">
    	<table id="dgspe"></table>  
    	
    	<div id="win">
				<div style="width: 500px; height: 500px; background-color: ; ">
					<p id="content"></p>
				</div>
			</div>
    </div>   
</div>
</body>
</html>